package apiPractice;

public class practice04 {
    public static void main(String[] args) {
        //method();
        method1();
    }

    private static void method1() {
        String str1="abcdefghijklmnopqrstuvwxyz ";
       String sum=null;
        long t1=System.currentTimeMillis();
        for(int i=1;i<=10000;i++){
            sum+=str1;
        }
        long t2=System.currentTimeMillis();
        System.out.println("循环后数组为"+sum.toString());
//        System.out.println("循环后数组为");
        System.out.println(t2-t1);
    }


    private static void method() {
        String str1="abcdefghijklmnopqrstuvwxyz ";
        StringBuilder sb1=new StringBuilder();
        StringBuffer sb2=new StringBuffer();
        long t1=System.currentTimeMillis();
        for(int i=1;i<=10000;i++){
           sb1.append(str1);
           sb2.append(str1);
        }
        long t2=System.currentTimeMillis();
        System.out.println("循环后数组为"+sb1.toString());
        System.out.println("循环后数组为"+sb2.toString());
        System.out.println(t2-t1);
    }
}
